#if !defined(FRAMEWORK_ADAPTER_H)
#define FRAMEWORK_ADAPTER_H

#include "Framework.h"
#include "DXUT.h"
#include "SDKMedia.h"
#include <d3d11.h>
#include <stdexcept>
#include <rt/Exceptions/COMException.h>

namespace MandelShader
{
	class FrameworkAdapter : public IFramework
	{
	public:
		FrameworkAdapter()
		{
		}
		virtual ~FrameworkAdapter() { }

		virtual ID3D11RenderTargetView *GetRenderTargetView()
		{
			return ::DXUTGetD3D11RenderTargetView();
		}
		virtual ID3D11DepthStencilView *GetDepthStencilView()
		{
			return ::DXUTGetD3D11DepthStencilView();
		}
		virtual rt::tstring FindMedia(rt::tstring const &fileName)
		{
			TCHAR str[MAX_PATH];
			THR(::DXUTFindDXSDKMediaFileCch(str, MAX_PATH, fileName.c_str()));
			return rt::tstring(str);
		}
		virtual HRESULT CompileFromFile(rt::tstring const &file, DWORD shaderFlags,
			std::string const &entryPoint, std::string const &profile,
			ID3D10Blob **shader, ID3D10Blob **errors)
		{
			return ::D3DX11CompileFromFile(file.c_str(), 0, 0,
				entryPoint.c_str(), profile.c_str(),
				shaderFlags, 0, 0,
				shader, errors, 0);
		}
		virtual void DisplayCompileErrorMessage(char const *message)
		{
			::OutputDebugStringA(message);
		}
	};
}

#endif
